package com.tanhua.common.enums;

public enum AgeRangeEnum {

    UNDER_TWENTY(0, 17, "0-17岁"),
    TWENTY(18, 23, "18-23岁"),
    THIRTY(24, 30, "24-30岁"),
    FORTY(31, 40, "31-40岁"),
    FIFTY(41, 50, "41-50岁"),
    OVER_FIFTY(51, 200, "50岁以上");

    private int min;
    private int max;
    private String desc;

    AgeRangeEnum(int min, int max, String desc) {
        this.min = min;
        this.max = max;
        this.desc = desc;
    }

    public int getMin() {
        return min;
    }

    public int getMax() {
        return max;
    }

    public String getDesc() {
        return desc;
    }

    public static String getAgeArea(Integer age) {
        String ageArea = "未知";
        for (AgeRangeEnum ageRangeEnum : values()) {
            if (age >= ageRangeEnum.min && age <= ageRangeEnum.max) {
                ageArea = ageRangeEnum.desc;
                break;
            }
        }
        return ageArea;
    }
}